package com.hinacom.pix.entity;

import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

/**
 * Created by fyu on 2016/8/31.
 */
public class AssigningAuthority {
    private String namespaceId;
    private String universalId;
    private String universalIDType;

    public String getNamespaceId() {
        return namespaceId;
    }

    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }

    public String getUniversalId() {
        return universalId;
    }

    public void setUniversalId(String universalId) {
        this.universalId = universalId;
    }

    public String getUniversalIDType() {
        return universalIDType;
    }

    public void setUniversalIDType(String universalIDType) {
        this.universalIDType = universalIDType;
    }

    public static AssigningAuthority createInstanceWithDefualtDomain()
    {
        AssigningAuthority assigningAuthority = new AssigningAuthority();
        ResourceBundle bundle = PropertyResourceBundle.getBundle("pix");
        if(bundle.containsKey("domain-namespace-id"))
        {
            assigningAuthority.setNamespaceId(bundle.getString("domain-namespace-id"));
        }
        if(bundle.containsKey("domain-universal-id"))
        {
            assigningAuthority.setUniversalId(bundle.getString("domain-universal-id"));
        }
        if(bundle.containsKey("domain-universal-id-type")) {
            assigningAuthority.setUniversalIDType(bundle.getString("domain-universal-id-type"));
        }
        return assigningAuthority;
    }
    @Override
    public String toString() {
        String result = String.format("%s&%s&%s",this.getNamespaceId(),this.getUniversalId(),this.getUniversalIDType());
        return result;
    }
}
